/* 封装和部门相关的接口 */
import request from '@/utils/request'

/**
 * 获取部门列表数据
 * @returns Promise
 */
export function getDepartmentList() {
  return request({
    method: 'get',
    url: '/company/department'
  })
}

/**
 * 删除部门
 * @param {*} id 部门id
 * @returns
 */
export function delDepartment(id) {
  return request({
    method: 'DELETE',
    url: `/company/department/${id}`
  })
}

/**
 * 添加部门
 * @param {*} data 部门数据
 * @returns Promise
 */
export function addDepartment(data) {
  return request({
    method: 'POST',
    url: '/company/department',
    data
  })
}

/**
 * 获取部门详情
 * @param {*} id
 * @returns
 */
export function getDepartmentDetail(id) {
  return request({
    method: 'get',
    url: '/company/department/' + id
  })
}

/**
 * 修改部门
 * @param {*}} data
 * @returns
 */
export function updateDepartment(data) {
  return request({
    method: 'put',
    url: '/company/department/' + data.id,
    data
  })
}
